<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EmpAdd.aspx.cs" Inherits="PayRoller.Manage.OrgInfo.EmpAdd" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register src="../../UControls/TXTFormatDate.ascx" tagname="TXTFormatDate" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../css.css" type="text/css" rel="stylesheet">
    <link href="../../Css/StyleSheet.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <script language="javascript" src="../../js/jslib.js" type="text/javascript"></script>

    <script language="javascript">
function Check() {
var vtxtEmpName=document.getElementById("txtEmpName");
var vtxtOrgEmpSid=document.getElementById("txtOrgEmpSid");
var vtxtTaxFileNumber=document.getElementById("txtTaxFileNumber");
var vtxtPayStartDate=document.getElementById("txtPayStartDate");
var vtxtPayFrequency=document.getElementById("txtPayFrequency");
					
if( vtxtEmpName.value.length == 0 )
{
alert("Field 'Employee Name' is not valid!");
vtxtEmpName.focus();
return false;
}					
if( vtxtOrgEmpSid.value.length == 0 )
{
alert("Field 'Employee ID' is not valid!");
vtxtOrgEmpSid.focus();
return false;
}					
if( vtxtTaxFileNumber.value.length == 0 )
{
alert("Field 'Tax File Number' is not valid!");
vtxtTaxFileNumber.focus();
return false;
}	
if( vtxtPayStartDate.value.length == 0 )
{
alert("Field 'Payment Start Date' is not valid!");
vtxtPayStartDate.focus();
return false;
}					
if( vtxtPayFrequency.value.length == 0 )
{
alert("Field 'Pay Frequency' is not valid!");
vtxtPayFrequency.focus();
return false;
}		
		
return true;
}

function Check1() {
var vtxtEmpSid=document.getElementById("txtEmpSid");
var vtxtBankName=document.getElementById("txtBankName");
var vtxtBsb=document.getElementById("txtBsb");
var vtxtAccountNum=document.getElementById("txtAccountNum");		
					
if( vtxtEmpSid.value.length == 0 )
{
alert("Employee details must be entered before bank details!");
return false;
}					
if( vtxtBankName.value.length == 0 )
{
alert("Field 'Bank Name' is not valid!");
vtxtBankName.focus();
return false;
}					
if( vtxtBsb.value.length == 0 )
{
alert("Field 'BSB' is not valid!");
vtxtBsb.focus();
return false;
}					
if( vtxtAccountNum.value.length == 0 )
{
alert("Field 'Account Num' is not valid!");
vtxtAccountNum.focus();
return false;
}		
		
return true;
}
    </script>

</head>
<body topmargin="0" leftmargin="0">
    <form id="form1" runat="server">
    <asp:ScriptManager id="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table width="99%" align="center" border="0" cellspacing="0" cellpadding="0" class="NormalText">
        <tr>
            <td height="40" class="HeadText" colspan="2">
                Employee Details
            </td>
        </tr>
        <tr>
            <td height="24" colspan="2">
                Please enter employee details first.
            </td>
        </tr>
        <tr>
            <td height="24">
                Employee Name:
            </td>
            <td>
                <asp:TextBox ID="txtEmpName" runat="server" Width="200px"></asp:TextBox>
                <span class="styledot" style="color: #ff0000">*</span>
            </td>
        </tr>
        <tr>
            <td width="20%" height="24">
                Employee ID:
            </td>
            <td>
                <asp:TextBox ID="txtOrgEmpSid" runat="server" Width="200px"></asp:TextBox>
                <span class="styledot" style="color: #ff0000">*</span>
            </td>
        </tr>
        <tr>
            <td height="24">
                Tax File Number:
            </td>
            <td>
                <asp:TextBox ID="txtTaxFileNumber" runat="server" Width="200px"></asp:TextBox>
                <span class="styledot" style="color: #ff0000">*</span>
            </td>
        </tr>
        <tr>
            <td height="24">
                Next Payday:
            </td>
            <td>
                <uc1:TXTFormatDate ID="txtNextPayday" runat="server" />
                <span class="styledot" style="color: #ff0000">*</span>
            </td>
        </tr>
        <tr>
            <td height="24">
                Pay Frequency:             </td>
            <td>
                <asp:TextBox ID="txtPayFrequency" runat="server" Width="200px"></asp:TextBox>
                <span class="styledot" style="color: #ff0000">*</span>
            </td>
        </tr>
        <tr>
            <td height="24">
                Address:
            </td>
            <td>
                <asp:TextBox ID="txtAddress1" runat="server" Width="200px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td height="22">
            </td>
            <td>
                <asp:TextBox ID="txtAddress2" runat="server" Width="200px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td height="24" colspan="2">
                <div align="center">
                    <asp:Button ID="Button1" runat="server" Text=" Save " OnClick="Button1_Click" Width="70px"
                        CssClass="submitBtn" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="bnSelect" runat="server" Text="Add Bank" Width="70px" CssClass="submitBtn" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="Index.aspx?OrgSid=<%=OrgSid%>">
                        Return</a>
                    <input id="txtEmpSid" runat="server" style="width: 37px" type="hidden" />
                    <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup"
                        Width="98%">
                        <asp:Panel ID="Panel3" runat="server" Style="cursor: move; background-color: #DDDDDD;
                            border: solid 1px Gray; color: Black">
                            <div>
                                Bank Details:<br />
                            </div>
                        </asp:Panel>
                        <table width="100%" border="0" cellspacing="1" cellpadding="1">
                            <tr>
                                <td width="20%" height="22">
                                    <div align="left">
                                        Bank Name:</div>
                                </td>
                                <td style="width: 165px">
                                    <asp:TextBox ID="txtBankName" runat="server"></asp:TextBox>
                                </td>
                                <td width="20%">
                                    &nbsp;
                                </td>
                                <td width="30%">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    <div align="left">
                                        Branch:</div>
                                </td>
                                <td style="width: 165px">
                                    <asp:TextBox ID="txtBranch" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    <div align="left">
                                        Account Name:</div>
                                </td>
                                <td style="width: 165px">
                                    <asp:TextBox ID="txtAccountName" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    <div align="left">
                                        BSB:</div>
                                </td>
                                <td style="width: 165px">
                                    <asp:TextBox ID="txtBsb" runat="server"></asp:TextBox>
                                </td>
                                <td>
                                    <div align="left">
                                        Account Number:</div>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtAccountNum" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="height: 26px">
                                    <div align="left">
                                        Reference:</div>
                                </td>
                                <td style="height: 26px; width: 165px;">
                                    <asp:TextBox ID="txtPayReference" runat="server"></asp:TextBox>
                                </td>
                                <td style="height: 26px">
                                    &nbsp;
                                </td>
                                <td style="height: 26px">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td height="22">
                                    &nbsp;
                                </td>
                                <td style="width: 165px">
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                        <table width="100%" cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td align="center" style="height: 24px">
                                    <asp:Button ID="Button2" runat="server" Text="OK" OnClick="Button2_Click" Width="60px" />
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Button ID="CancelButton" runat="server" Text="Cancel" Width="60px" />
                                    <asp:Button ID="Button3" runat="server" Text="Button" Width="0" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="bnSelect"
                        PopupControlID="Panel1" BackgroundCssClass="modalBackground" OkControlID="Button3"
                        OnOkScript="Check1()" CancelControlID="CancelButton" DropShadow="true" PopupDragHandleControlID="Panel3" />
                </div>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="2">
                <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#999999">
                    <tr bgcolor="#CCCCCC">
                        <td width="30%" height="22">
                            <div align="left">
                                Bank Name
                            </div>
                        </td>
                        <td width="30%">
                            <div align="left">
                                Account Name
                            </div>
                        </td>
                        <td>
                            <div align="left">
                                Reference</div>
                        </td>
                        <td align="center">
                            Delete
                        </td>
                    </tr>
                    <%		
                        for (int i = 0; i < dtBank.Rows.Count; i++)
                        {
                            string BankSid = dtBank.Rows[i]["Sid"].ToString();
                            string BankName = dtBank.Rows[i]["BankName"].ToString();
                            string AccountName = dtBank.Rows[i]["AccountName"].ToString();
                            string PayReference = dtBank.Rows[i]["PayReference"].ToString();
                    %>
                    <tr bgcolor="#FFFFFF">
                        <td height="22">
                            <div align="left">
                                <%=BankName%></div>
                        </td>
                        <td>
                            <div align="left">
                                <%=AccountName%></div>
                        </td>
                        <td>
                            <div align="left">
                                <%=PayReference%></div>
                        </td>
                        <td align="center">
                            <a href="EmpAdd.aspx?EmpSid=<%=txtEmpSid.Value%>&BankSid=<%=BankSid%>" onclick="return confirm('???????????');">
                                Delete</a>
                        </td>
                    </tr>
                    <%
                        }
                    %>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="2" height="10">
            </td>
        </tr>
        <tr>
            <td height="22" colspan="2">
                <div align="left">
                    <asp:Label ID="lblTip" runat="server"></asp:Label>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
